]> permondes.de Git - Analog_Engine.git/blame - scripts/TP1 04.12 Harmonic Oscillator.LACE
Further examples of harmonic oscillation
[Analog_Engine.git] / scripts / TP1 04.12 Harmonic Oscillator.LACE
CommitLineData
4124db17
P
1# Harmonic Oscillator
2# A mass m is subject to a force F=-k*r.
3# What is the trajectory if the mass starts at position (a,0,0)?
4# How much time does it take to pass through zero?
5# What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)?
6# Compare to the case including gravity on earth in x direction
7# m*x'' = -k*x + g
8# m*y'' = -k*y (z can be set to 0).
9
10coefficient.1(-1) -> -a # (a,0,0), has to be negative because x' is negative
11coefficient.2 -> k/m_x # k/m for x
12coefficient.3(+1) -> v0 # (0,v0,0), has to be positive because y'' is positive
13coefficient.4 -> k/m_y # k/m for y, identical to k/m for x
14coefficient.5(-1) -> -g # g
15
16iintegrate x'' -> -x'
17iintegrate -x' -> x
18 IC: -a
19cmultiply (k/m_x, x) -> k/m*x
20isum (k/m*x, -g) -> -k/m*x+g
21assign (-k/m*x+g) -> x''
22
23iintegrate y'' -> -y'
24 IC: v0
25iintegrate -y' -> y
26cmultiply (k/m_y, y) -> k/m*y
27invert (k/m*y) -> -k/m*y
28assign (-k/m*y) -> y''
29
30output x -> out.x
31output.y -> out.y